<html xmlns:th="http://www.thymeleaf.org"  
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"    
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">    
<html>
<head th:include="common/common::header">
    <meta charset="UTF-8">
<!--     <script type="text/javascript" src="/resources/error/lib/layer/2.4/layer.js"></script> -->
   <style type="text/css">
      #index {
            justify-content: space-between;
            flex-wrap: wrap;
            opacity: 0;
        }
        .index-l {
            width: 100%;
            margin-top: 0.5%;
        }
    </style>
</head>
<body>
<!-- <div id="index"> -->
<!-- 	<div class="index-l"> -->
		<div class="index-l" id="UserToolbar" style="margin-top: 0.5%;">
	      <div>
	      	  <shiro:hasPermission name="sys:resource:add">
	      	  <a href="javascript:void(0)" onclick="opendialog({title:'资源-新增',width:'50%',height:'70%',url:'system/resource/add_01',onClose:searcha_resorces})" data-options="iconCls:'fa fa-pencil'" id="addr" class="easyui-linkbutton primary" style="height: 32px;border-left-width: 1px;margin-left: 29px;">新增</a>
       		  </shiro:hasPermission>
       		   <shiro:hasPermission name="sys:resource:edit">
       		  <a href="javascript:void(0)" onclick="opendialog({title:'资源-编辑',width:'50%',height:'70%',checkSelect:true,gridId:'resourceTable',url:'system/resource/edit_01',onClose:searcha_resorces})"  class="easyui-linkbutton error" id="reedit" data-options="iconCls:'fa fa-gears'">修改</a>
       		  </shiro:hasPermission>
       		  <a href="javascript:void(0)" onclick="searcha_resorces()" id="rebreak" class="easyui-linkbutton success" data-options="iconCls:'fa fa-refresh'">刷新</a>
	      </div>
	      </div>
	      <div style="opacity: 1;width:100%;min-height:780px;margin-top: 0.5%">
	        <table id="resourceTable" style="opacity: 1;width:100%;height:780px;margin-top: 2%" class="easyui-treegrid" data-options="align:'center',rownumbers:true,border:false,url:'/system/resource/loadResource.do',idField:'id',treeField:'name',fit:true,fitColumns:true,toolbar:'#resourceToolbar'">
				<thead>
					<tr>
						<th data-options="field:'name',width:100,align:'center'">资源名称</th>
						<th data-options="field:'type',width:100,align:'center'">资源类型</th>
						<th data-options="field:'target',width:100,align:'center'">资源地址</th>
						<th data-options="field:'sort',width:100,align:'center'">资源排序</th>
						<th data-options="field:'icon',width:100,align:'center'">资源图标</th>
						<th data-options="field:'enabled',formatter:enabledFormatter,width:100,align:'center'">资源状态</th>
					</tr>
				</thead>
			</table>
	</div>
<!-- </div> -->
<script type="text/javascript">
		function enabledFormatter(value, row, index) {
			switch (value) {
			case 1:
				return "<font color='green'>可用</font>";
			case '1':
				return "<font color='green'>可用</font>";
			case 0:
				return "<font color='red'>不可用</font>";
			case '0':
				return "<font color='red'>不可用</font>";
			}
		};
		
		function searcha_resorces() {
			$('#resourceTable').treegrid('reload')
		}
   </script>
</body>
</html>